$(function () {
    var id = getUrlParam("id");
    console.log("id="+id);
    findUserById(id);
});

function findUserById(id) {
    $.ajax({
        url:"http://localhost:7080/UserServlet.do",
        type:"post",
        data:{
            method:"findUserById",
            id:id
        },
        dataType:"json",
        success:function (data) {
            console.log("打印"+data);
            var result = data.data;
            $("#name").text(result.name);
            console.log(result.name);
            var state = result.state;
            if(state == 1){
                state ="非冻结状态";
            }else {
                state ="冻结状态";
            }
            $("#state").text(state);
            $("#trueName").text(result.truename);
            $("#cardId").text(result.cardid);
            $("#email").text(result.email);
            $("#telephone").text(result.telephone);
            $("#qqId").text(result.qqid);
            $("#regTime").text(result.regtime);
            $("#question").text(result.question);
            $("#answer").text(result.answer);
        },
        error:function () {
            
        }
    })
}
//a标签跳转获取参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURI(r[2]); return null;
}